bpf: Add sanity check for upper ptr_limit
authorPiotr Krysiuk <piotras@gmail.com>
Tue, 16 Mar 2021 08:47:02 +0000 (09:47 +0100)
committerSalvatore Bonaccorso <carnil@debian.org>
Fri, 19 Mar 2021 18:20:52 +0000 (18:20 +0000)
commite45dd084b0d09611ff132846d713c5e2d98ccac5
tree2f5d1f5bb02c1dcf4ebccc9cf969a51c035deb54
parentc8129f85dba04e7b6bcff909190fcd8c7e74691f
bpf: Add sanity check for upper ptr_limit

Origin: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git/commit?id=1b1597e64e1a610c7a96710fc4717158e98a08b3

Given we know the max possible value of ptr_limit at the time of retrieving
the latter, add basic assertions, so that the verifier can bail out if
anything looks odd and reject the program. Nothing triggered this so far,
but it also does not hurt to have these.

Signed-off-by: Piotr Krysiuk <piotras@gmail.com>
Co-developed-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Gbp-Pq: Topic bugfix/all
Gbp-Pq: Name bpf-Add-sanity-check-for-upper-ptr_limit.patch
kernel/bpf/verifier.c